package com.java.io;

import java.io.FileInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileStreamTest {
	public static void main(String[] args) {
		FileInputStream fis=null;
		FileOutputStream fos=null;
		int code=Integer.parseInt(args[2]);
		try {
			fis=new FileInputStream(args[0]);
			fos=new FileOutputStream(args[1]);
			while(fis.available()>0){
				fos.write(fis.read()^code);
			}
		}  catch (IOException e) {
			e.printStackTrace();
		} finally{
			if(fis!=null){
				try {
					fis.close();
					fos.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
